<?php
    class M_Lesson extends CI_Model {
        function __construct() {
            parent::__construct();
        }
        function GetCategoryIntro($url) {
            $query = $this->db->query("select * from category where `Deleted`=0 and url ='$url' ");
            if ($query->num_rows() > 0) {
                $row = $query->row();
                $title = $row->Introduction;
                return $title;
            } else {
                return "Chức năng đang được nâng cấp!";
            }
        }
        function GetChapterListURL($cate_id) {
            $query = $this->db->query("select * from chapter where `Deleted`=0 and category_ID='$cate_id' order by STT ASC");
            $rows = array();
            
            if ($query->num_rows() > 0) {
                foreach ($query->result() as $row) {
                    $rows[] = $row;
                }
                return $rows;
            } else {
                return null;
            }
        }
    }
?>
